﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Net;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Animation;
using System.Windows.Shapes;
using Microsoft.ISVApps.Common.ViewModels;

namespace Microsoft.ISVApps.Common.Controls
{
    
    public partial class JumpList : UserControl
    {
        //Event handler users should attach to
        public event EventHandler<JumpListEventArgs> SelectionChanged;

        public JumpList()
        {
            InitializeComponent();
        }

        private void ListBox_Tap(object sender, GestureEventArgs e)
        {
            if (SelectionChanged != null && (sender as ListBox).SelectedItem!=null)
            {
                SelectionChanged(this, new JumpListEventArgs() { Selection = (sender as ListBox).SelectedItem as JumpListItem });
                (sender as ListBox).SelectedIndex = -1;
            }
        }
    }

    public class JumpListEventArgs : EventArgs
    {
        public JumpListItem Selection { get; set; }
    }

}
